require (['./config'], () => {
    require (['swiper','template','request','header','footer'],( swiper,template,request)=> {
        class List {
            constructor () {
              this.init()
              this.banner()
            }
            init () {
              // 从url上取到id
              const id = window.location.hash.slice(1)
              // 根据id取请求当前分类的数据
              request.getCategory(id).then(resp => {
                console.log(resp)
                if (resp.code === 200) {
                  const { name } = resp.data.category
                  const { list } = resp.data.items
                  $('#goodsClassify').html(template('classifyTempalte', { name, list }))
                }
              })
            }
          
            banner() {
              var mySwiper = new Swiper('.swiper-container', {
                  autoplay: 3000, 
                  speed: 2000,
                  pagination: '.swiper-pagination',
                  
                    prevButton: '.swiper-button-prev',
                    nextButton: '.swiper-button-next',
                    hideOnClick: false,
                 
                 loop: true,
              })
          }
          }
          new List()
    })
})